//
//  BLNoneNavibarWebViewController.m
//  EClub
//
//  Created by iBenz on 16/7/25.
//  Copyright © 2016年 EC. All rights reserved.
//

#import "BLNoneNavibarWebViewController.h"

@interface BLNoneNavibarWebViewController ()<UIScrollViewDelegate> {
    UIColor *_bkColor;
    UIView *_bar;
    UINavigationBar *_naviBar;
}
@end

@implementation BLNoneNavibarWebViewController

- (void)dealloc {
    [self.webView scrollView].delegate = nil;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    _bar = [UIView new];
    [self.view addSubview:_bar];
    _naviBar = [[UINavigationBar alloc] init];
    [self.view addSubview:_naviBar];
    //[_naviBar addSubview:self.leftBarButton];
    self.automaticallyAdjustsScrollViewInsets = NO;
    __weak typeof(self) weakSelf = self;
    [_bar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(weakSelf.view);
        make.centerX.equalTo(weakSelf.view);
        make.top.equalTo(weakSelf.view);//.offset(-20);
        make.height.mas_equalTo(64);
    }];
    [_naviBar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(weakSelf.view);
        make.left.equalTo(weakSelf.view);
        make.top.equalTo(weakSelf.view).offset(20);
        make.height.mas_equalTo(44);
    }];
    [self.webView mas_remakeConstraints:^(MASConstraintMaker *make) {
//        make.size.equalTo(weakSelf.view);
        make.width.equalTo(weakSelf.view);
        make.height.equalTo(weakSelf.view).offset(20);
        make.centerX.equalTo(weakSelf.view);
        make.bottom.equalTo(weakSelf.view);
    }];
    
    [self.webView scrollView].delegate = self;
    _naviBar.translucent = YES;
    _naviBar.exclusiveTouch = YES;
    [_naviBar setBackgroundImage:[UIImage new] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
    [_naviBar setShadowImage:[UIImage new]];
    [_naviBar pushNavigationItem:self.navigationItem animated:NO];
    _bar.backgroundColor = [UIColor blueColor];
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
}

- (void)navigationBarDidChangedAlpha:(CGFloat)alpha {
    _bar.alpha = alpha;
}

@end
